<?php 
/*
# ------------------------------------------------------------------------
# JA Job Board Package
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/
defined('_JEXEC') or die('Restricted access'); 
?>

<script type="text/javascript" language="javascript">
//<![CDATA[
function submitbutton(pressbutton) {
	var form = document.adminForm;

	if (pressbutton == 'cancel') {
		submitform( pressbutton );
		return;
	}
	if ( pressbutton == 'save' || pressbutton == 'apply' ){
		if(form.feed_name.value == '' ){
		    alert('<?php echo JText::_('Feed name could not be empty')?>');
			form.feed_name.focus();
			return;
		}
		if(form.feed_alias.value == '' ){
		    alert('<?php echo JText::_('Feed alias could not be empty')?>');
			form.feed_alias.focus();
			return;
		}
		submitform( pressbutton );
	}					
	else {
		submitform( pressbutton );
	}
}
//]]>
</script>
<form action="index.php" method="post" name="adminForm" id="adminForm" class="adminForm">
	<fieldset class="adminform">
		<?php echo $this->getFeedTabs();?>
	</fieldset>
	<fieldset>
    	<legend><?php echo JText::_('Settings');?></legend>
	<table border="0" cellpadding="3" cellspacing="0" align="left">
    	<tr>
            <td><?php echo JText::_('Enable'); ?>?</td><td><?php echo $this->lists['renderPublishedList'];?></td>
        </tr>
        <tr>
            <td><?php echo JText::_('Title');?>:</td>
            <td><input type="text" size="75" maxlength="255" name="feed_name" value="<?php echo($this->name); ?>" /><font color="Red">*</font></td>
        </tr>
        <tr>
            <td><?php echo JText::_('Alias');?>:</td>
            <td><input type="text" size="75" maxlength="255" name="feed_alias" value="<?php echo($this->alias); ?>" /><font color="Red">*</font></td>
        </tr>
        <tr>
            <td><?php echo JText::_('Description'); ?>:</td><td><?php echo $this->editor->display( 'feed_description',  $this->description, 500, 200, 70, 20, 1 ) ; ?></td>
        </tr>
        <tr><td><?php echo JText::_('Type'); ?>:</td><td><?php echo $this->lists['rssTypeList']; ?></td>
        </tr>
        <tr>
            <td><?php echo JText::_('Number Items'); ?>: </td><td>
            	<select name="msg_count">
            		<option value="5" <?php echo $this->count==5?'selected':''; ?>>5</option>
            		<option value="5" <?php echo $this->count==10?'selected':''; ?>>10</option>
            		<option value="5" <?php echo $this->count==15?'selected':''; ?>>15</option>
            		<option value="5" <?php echo $this->count==20?'selected':''; ?>>20</option>
            		<option value="5" <?php echo $this->count==30?'selected':''; ?>>30</option>
            		<option value="5" <?php echo $this->count==50?'selected':''; ?>>50</option>
            	</select>
            	<!--<input type="text" size="3" maxlength="3" name="msg_count" value="<?php echo $this->count; ?>" />-->
            </td>
        </tr> 
        <tr>
            <td><?php echo JText::_('Order By'); ?>:</td><td><?php echo $this->lists['orderingList']; ?></td>
        </tr>
        <?php /*>> MAD 2007/10/10 */  ?>
        <tr>
            <td><?php echo JText::_('Max Chars'); ?>:</td><td><?php echo $this->lists['numWordsList']; ?></td>
        </tr>
        <?php /*<< MAD 2007/10/10 */  ?>
        <tr>
            <td><?php echo JText::_('Author Contact'); ?>:</td><td><?php echo $this->lists['renderAuthorList']; ?></td>
        </tr>
        <tr>
            <td><?php echo JText::_('Cache Time'); ?>:</td><td><input type="text" size="10" maxlength="10" name="feed_cache" value="<?php echo $this->cache; ?>" /></td>
        </tr>
        
        
        <?php /*>> AGE 2007/09/25 */  ?>
        <!--<tr>
            <td>Excluded Categorie(s)</td><td><?php echo $this->lists['excludedcatlist'];?></td>
        </tr>-->
        
       <!-- <tr>
            <td><?php echo JText::_('Feed image'); ?>:</td>
            <td>
                <input onchange="loadImg(this)" type="text" size="20" name="feed_imgUrl" value="<?php echo $this->imgUrl; ?>" />&nbsp;<?php echo JText::_("[Tab] to preview or leave blank to leave out image details from feed");?>
            </td>
        </tr>        
        <tr>
            <td >&nbsp;</td><td valign="top"><?php echo JText::_('Image Preview'); ?>:<br /> <img id="feedImg" src="<?php echo $this->imgUrl; ?>" /></td>
        </tr>-->
        <tr>
            <td><?php echo JText::_('Feed button'); ?>:</td>
            <td><?php echo($this->lists['feedButtons']);?>&nbsp;
                <img id="feedButton" src="<?php echo (JURI::root() . "components/com_jajobboard/views/jafeeds/images/buttons/" . $this->BtnImgUrl); ?>" />
            </td>
        </tr>
       	
        	
        
    </table>
    </fieldset>
     <fieldset>
     	<legend><?php echo JText::_('Categories and Locations Filters'); ?></legend>
    	<table>
    		<tr>
            	<td><?php echo JText::_('Category(s)');?>:</td><td><?php echo $this->lists['filter_cat_id'];?></td>
        	</tr>
        	<tr>
            	<td><?php echo JText::_('Location(s)');?>:</td><td><?php echo $this->lists['filter_location_id'];?></td>
        	</tr>
        	<tr class="sectiontableentry1">
        		<td><?php echo JText::_('Zip code'); ?>:</td><td><input type="text" name="filter_zipcode" value="<?php echo $this->feed->filter_zipcode; ?>" /></td> 
        	</tr>
        	<tr>
        		<td><?php echo JText::_('Publish date (days)'); ?>:</td><td><input type="text" name="filter_date" value="<?php echo $this->feed->filter_date; ?>" /><?php echo JText::_('days ago'); ?><small><?php echo "<br />".JText::_('Eg: if the value is 5, only jobs published in the last 5 days is listed')."<br />".JText::_("If value equals to -1, all jobs irrespective of effected date will be filtered out"); ?></small></td> 
        		
        	</tr>
        	<tr>
            	<td><?php echo JText::_('Only premium jobs');?>?</td>
            	<td>
            		<input onclick="update_is_premium(this.value)" type="radio" name="check_is_premium" value="0" <?php echo ($this->feed->filter_is_premium==0)?'checked="true"':'';?> /><?php echo JText::_('No');?>
            		<input onclick="update_is_premium(this.value)" type="radio" name="check_is_premium" value="1" <?php echo ($this->feed->filter_is_premium==1)?'checked="true"':'';?> /><?php echo JText::_('Yes');?>
            	</td>
        	</tr>
        	
    	</table>
    </fieldset>
    <fieldset>
    	<legend><?php echo JText::_('Special Filter'); ?></legend>
    	<table>
    		<tr>
            <td><?php echo JText::_('Excluded Job ID(s)'); ?>:</td>
            <td>
                <textarea name="filter_exitems" cols="30" rows="3" ><?php echo $this->exitems; ?></textarea>
                <br /><?php echo JText::_('Enter job id(s) you want to exclude.'); ?>
                <br /><?php echo JText::_('Separate id with a comma ",".'); ?> <br /><?php echo JText::_('Example: 1, 2, 3, 4, 5, 6'); ?>
            </td>
            <tr>
            <td><?php echo JText::_('Excluded Employer ID(s)'); ?>:</td>
            <td>
                <textarea name="filter_exemployers" cols="30" rows="3" ><?php echo $this->exemployers; ?></textarea>
                <br /><?php echo JText::_('Enter employer id(s) you want to exclude.'); ?>
                <br /><?php echo JText::_('Separate id with a comma ",".'); ?> <br /><?php echo JText::_('Example: 1, 2, 3, 4, 5, 6'); ?>
            </td>
            <tr>
            <td><?php echo JText::_('Included Employer ID(s)'); ?>:</td>
            <td>
                <textarea name="filter_inemployers" cols="30" rows="3" ><?php echo $this->inemployers; ?></textarea>
                <br /><?php echo JText::_('Enter employer id(s) you want to include.'); ?>
                <br /><?php echo JText::_('Separate id with a comma ",".'); ?> <br /><?php echo JText::_('Example: 1, 2, 3, 4, 5, 6'); ?>
            </td>
        </tr>
    	</table>
    </fieldset>
    <input type="hidden" name="is_user" value="<?php echo (isset($this->is_user))?$this->is_user:0; ?>" ?>
    <input type="hidden" name="filter_is_premium" value="<?php echo $this->feed->filter_is_premium;?>" />
    <input type="hidden" name="id" value="<?php echo $this->id;?>" />
    <input type="hidden" name="cid[]" value="<?php echo $this->id;?>" />
    <input type="hidden" name="option" value="com_jajobboard" />
    <input type="hidden" name="task" value="" />
    <input type="hidden" name="view" value="jafeeds" />
    <?php echo JHTML::_( 'form.token' ); ?>
</form>
<script type="text/javascript">		
	
	function update_is_premium(value)
	{
		form = document.adminForm;
		form.filter_is_premium.value = value;
	}
//    checkRenderHtml();
//
//    $('feed_renderHTML').addEvent('change', function(){
//        checkRenderHtml();
//    });
//    $('feed_renderImages').addEvent('change', function(){
//        checkRenderHtml();
//    });

    function checkRenderHtml()
    {
        if($('feed_renderHTML').value == 0)
        {
            $('feed_renderImages').value = 0;
            $('feed_renderImages').setProperty('disabled','disabled');
        }
        else
        {
            $('feed_renderImages').setProperty('disabled','');
        }
    }
    function loadImg(elem) {
        document.getElementById("feedImg").src = elem.value;
    }
    function loadButton(elem) {
        document.getElementById("feedButton").src = '<?php echo(JURI::root() . "components/com_jajobboard/views/jafeeds/images/buttons/");?>' + elem.value;
    }
</script>